
#pragma once
#include "orangepch.h"
#include "Renderer/Shader.h"
#include "glad/glad.h"

namespace Orange
{
    class OpenGLShader : public Shader
    {
    public:
        OpenGLShader(const std::string &filepath);
        OpenGLShader(const std::string &name,const std::string &vertexShaderSrc, const std::string &fragmentShaderSrc);
        ~OpenGLShader();
         virtual void SetUniformMat4(const std::string& name, const glm::mat4& mat) override;
        virtual void Bind() override;
        virtual void UnBind() override;

        uint32_t GetUniformLocation(const std::string& name) ;
        void UploadUniformMat4(const std::string& name , const glm::mat4& mat);

    private:
        std::string ReadFile(const std::string &filepath);
       
        std::unordered_map<GLenum, std::string> PreProcess(const std::string &source);
    
        void Compile(std::unordered_map<GLenum, std::string> &shaderSource);
        std::string m_Name;
        uint32_t m_RendererId;
    };
}